package arrays;

import java.util.Arrays;

public class TestDemo {
    public static void main(String[] args) {
        MyArrayList myArrayList=new MyArrayList();
        myArrayList.add(0,1);
        myArrayList.add(1,2);
        myArrayList.add(2,3);
        myArrayList.add(3,4);
        myArrayList.display();
        System.out.println("===========");
        myArrayList.display();
    }
    public static void swapArray(int[] array1,int[] array2) {
        int len = Math.min(array1.length,array2.length);//abs
        for (int i = 0; i < len; i++) {
            int tmp = array1[i];
            array1[i] = array2[i];
            array2[i] = tmp;
        }
    }
    public static void main1(String[] args) {
        int[] array1 = {1,3,5,7,9,11,13,15,17,19};
        int[] array2 = {2,4,6,8,10};
        swapArray(array1,array2);
        System.out.println(Arrays.toString(array1));
        System.out.println(Arrays.toString(array2));
    }
}
